package com.dz.state.memstate;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;
import java.net.URI;

/**
 * @ClassName HdTest
 * @Description TODO
 * @Author zhangdong
 * @Date 2020/11/18 23:07
 * @Version 1.0
 */
public class HdTest
{
    public static void main(String[] args) {
        Configuration configurable = new Configuration();
        configurable.set("dfs.client.use.hadoop.datanode.hostname","true");
        try {
            FileSystem fileSystem = FileSystem.get(URI.create("hdfs://localhost:9000"),configurable);
            fileSystem.copyFromLocalFile(new Path("D:\\Urule\\lock.properties"),new Path("/tst/"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
